<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>我的订单</title>
<script type="text/javascript" src="/lib/jquery/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="/lib/js/jquery.qrcode.min.js"></script> 
<link href="/lib/css/business.css" type="text/css" rel="stylesheet"/>
<style type="text/css">
.orderDetial{
	width: 800px;
	height: 100%;
	background-image: url('/lib/images/business/footer.png');
	background-repeat: repeat-y;
	margin-bottom: 10px;
}

</style>
</head>
<body>
<div class="bgbox">
<div id="header" class="header"  >
	<%	var name = session.account.name!;
	if(name == null){ %>
	<a href="javascript:showLogin();" class="left"><span>登录</span>|</a>
	<% }else{ %>
	<a href="/toModifyAccountMsg" class="left"><span>${session.account.name!}</span>|</a>
	<% } %>
	<a href="/business/cart/toCart" class="left"><span>我的购物车</span>|</a>
	<a href="/" class="left"><span>首页</span></a>
	<a href="/logout" class="right"><span>退出</span></a>
	<a href="/business/order/toOrderHistory" class="right"><span>我的订单</span>|</a>
</div>

<div id="main" class="main">
	<div class="separate"><span>所有订单</span></div>
	<% for(order in orders){ %>
		<% for(line in order.line){ %>
	<ul class="orderDetial">
		<li><span>&nbsp;</span></li>
		<div style="width:200px;display: inline-block;">
			<a href="/business/dish/getDishDetial?cuisine_dish_id=${line.cuisine_dish_id}" >
				<img alt="" src="${line.image}"/>
			</a>
		</div>
		<div style="width:400px;display: inline-block;">
			<% if(line.status == '1'){ %>
				待发货<br/>
			<% }else if(line.status == '2'){ %>
				发货中<br/>
			<% }else if(line.status == '3'){ %>
				待评价<br/>
			<% }else if(line.status == '4'){ %>
				<img src="/lib/images/business/dish/stars${line.grade}.gif"/><br/>
				${line.evaluation}
			<% } %>
		</div>
		<div style="width:100px;display: inline-block;">
			<span>数量：${line.quantity}</span><br/>
			<span>小计：￥${line.sum}</span><br/>
			<% if(line.status == '2'){ %>
				<input type="button" onclick="toConfirm(${line.id});" value="确认收货" />
			<% }else if(line.status == '3'){ %>
			<input type="button" onclick="showEval(${line.cuisine_dish_id});" value="评价" />	
			<% } %>
		</div>
		<li>${line.dish_name}</li>
		<li>
			<form method="post" action="/business/order/doEvaluation" id="${line.cuisine_dish_id}" style="display: none;">
				<input type="hidden" value="${line.id}" name="order_line_id"/>	
				<input type="hidden" value="${line.cuisine_dish_id}" name="cuisine_dish_id"/>
				评价：<textarea name="evaluation" rows="5" cols="80"></textarea>
				<input type="button" value="收起" onclick="hideEval(${line.cuisine_dish_id});">
				<br/>
				星级：<select name="grade" style="width: 50px;">
					<option value="0">0</option>
					<option value="1">1</option>
					<option value="2">2</option>
					<option value="3">3</option>
					<option value="4">4</option>
					<option value="5" selected>5</option>
				</select>	
				<br/>
				<input type="submit" value="提交"/>
				<input type="reset" value="重评"/>
			</form>
		</li>
	</ul>
	<% } %>
	<span>合计：￥ ${order.total}</span>
	<span style="float: right;">${order.create_date, dateFormat='yyyy年MM月dd日 HH:mm:ss'}</span>
	<hr>
	<% } %>
</div>
<div id="footer" class="footer">
	<table>
		<tr>
			<td><span class="right">咨询电话：</span></td>
			<td><a href="#" class="left">123456</a></td>
			<td><span class="">送餐电话：</span></td>
			<td><a href="#">123456</a></td>
		</tr>
	</table>
</div>
<!-- 登录div -->
<div class="login" id="login">
	<div class="fr_login">
	<img style="float:right;" onclick="hideLogin();" src="/lib/images/business/close.png"/>
	<br/>
	<iframe src="/toFrLogin"></iframe>
	</div>
</div>
</div>
<!-- 导航区 -->
<div class="nav">
	<a href="#" class="toTop" title="返回顶部"></a>
	<a class="showerweima" href="javascript:void();" title="二维码"></a><!-- 显示二维码 -->
</div>
<!-- 生成二维码 -->
<div class="erweima" style="display:none;">
	<div id="erweima"></div>
</div>
</body>
<script type="text/javascript" src="/lib/js/business.js"></script>
<script type="text/javascript">
function showEval(id){
	$('#'+id).fadeIn("slow");
}
function hideEval(id){
	$('#'+id).fadeOut('slow');
}
function toConfirm(id){
	$ajax({
		url: '/buisness/order/confirmRecive',
		data: {"order_line_id": id},
		dataType: 'json',
		success: function(){
			window.location.reload();
		},
		error: function(data, status){
			alert(status);
		}
	});
}
</script>
</html>